package pers.wangyu.crawler.web;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import pers.wangyu.crawler.service.BookService;

/**
 * @author wangyu
 * @Date 2018-05-06 00:00
 */
@Controller
@RequestMapping("/book")
public class BookController {

  @Autowired
  private BookService bookService;

  @RequestMapping(value = "/")
  public void save() {
//    ArrayList<String> bookUrls = new ArrayList<>();
//    bookUrls = ParseDoubanHtml.downloadBookUrl("编程");
//    ParseDoubanHtml.getBookInfo(bookUrls);

    //抓取豆瓣读书编程URL
    List<String> bookUrls = bookService.downloadBookUrl("编程");

    //解析书本信息
    bookService.getBookInfo(bookUrls);
  }
}
